package com.xyzq.cgate.admin.web;

import com.xyzq.cgate.common.response.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Mono;

import java.time.Duration;
import java.util.Map;

/**
 * @Description:
 * @author chenchen
 * @date 2019/4/17 13:32
 */
@RestController
@RequestMapping("/admin/login")
public class LoginController {

    @RequestMapping("login1")
    public ResponseEntity<?> login1(@RequestParam Map<String, Object> content) throws Exception {
        Thread.sleep(2000);
        return new ResponseEntity().success("mocktoken");
    }

    /*
    *  线程数：200
    *  Ramp-Up:0
    *  循环次数：1
    */
    //总体	200	27325	26306	46572	50615	52624	2014	52626	0.0	3.798165486070228	0.5712084813035304	0.8123029701654102
    //总体	200	2117	2122	2173	2176	2186	2024	2187	0.0	90.09009009009009	13.548704954954953	19.179335585585584

    @RequestMapping("login")
    public Mono<ResponseEntity<Object>> login(@RequestParam Map<String, Object> content) throws Exception {
        return Mono.just(new ResponseEntity<>().success("mocktoken")).delayElement(Duration.ofSeconds(2));
    }
}
